From: Jeroen van der Heijden Date: Mon, 2 Dec 2019 14:11:59 +0000 (+0100) Subject: Update cleri compat X-Git-Tag: archive/raspbian/2.0.44-1+rpi1~1^2~3^2~5^2~41 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=0ce92438cbd2461ccf0b575f298cd9ddec37b9d4;p=siridb-server.git Update cleri compat --- diff --git a/include/siri/grammar/gramp.h b/include/siri/grammar/gramp.h index 931fb0b4..dbea8711 100644 --- a/include/siri/grammar/gramp.h +++ b/include/siri/grammar/gramp.h @@ -23,4 +23,14 @@ #define HELP_OFFSET CLERI_GID_HELP_ACCESS #define HELP_COUNT CLERI_GID_HELP_TIMEZONES + 1 - HELP_OFFSET + + +#if CLERI_VERSION_MINOR >= 12 +#define CLERI_NODE_DATA(__node) ((intptr_t)(__node)->data) +#define CLERI_NODE_DATA_ADDR(__node) ((intptr_t *) &(__node)->data) +#else +#define CLERI_NODE_DATA(__node) ((intptr_t *)(__node)->result) +#define CLERI_NODE_DATA_ADDR(__node) ((intptr_t *) &(__node)->result) +#endif + #endif /* SIRI_GRAMP_H_ */ diff --git a/include/siri/version.h b/include/siri/version.h index d92e3cb6..c1ff0cac 100644 --- a/include/siri/version.h +++ b/include/siri/version.h @@ -15,7 +15,7 @@ * Note that debian alpha packages should use versions like this: * 2.0.34-0alpha0 */ -#define SIRIDB_VERSION_PRE_RELEASE "-alpha-0" +#define SIRIDB_VERSION_PRE_RELEASE "-alpha-1" #ifndef NDEBUG #define SIRIDB_VERSION_BUILD_RELEASE "+debug" diff --git a/src/cexpr/cexpr.c b/src/cexpr/cexpr.c index 0de7e2c1..81b82d5f 100644 --- a/src/cexpr/cexpr.c +++ b/src/cexpr/cexpr.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -383,7 +384,7 @@ static cexpr_t * CEXPR_walk_node( /* this is an integer or time expression, we can set the result * and the condition. */ - (*condition)->int64 = node->result; + (*condition)->int64 = CLERI_NODE_DATA(node); SET_CONDITION_AND_RETURN case CLERI_TP_CHOICE: /* in case of a string, set the value and return */ diff --git a/src/siri/db/aggregate.c b/src/siri/db/aggregate.c index a3578e39..dd4c5bb0 100644 --- a/src/siri/db/aggregate.c +++ b/src/siri/db/aggregate.c @@ -217,8 +217,8 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) case CLERI_GID_F_LIMIT: AGGR_NEW { - int64_t limit = children->node->children->node-> - children->next->next->node->result; + int64_t limit = CLERI_NODE_DATA(children->node->children->node-> + children->next->next->node); if (limit <= 0) { @@ -344,7 +344,7 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) { /* result is at least positive, checked earlier */ aggr->timespan = - (double) dlist->children->node->result; + (double) CLERI_NODE_DATA(dlist->children->node); if (!aggr->timespan) { @@ -359,8 +359,8 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) if (dlist->children->next != NULL) { /* result is always positive */ - aggr->group_by = dlist->children->next->next-> - node->result; + aggr->group_by = CLERI_NODE_DATA( + dlist->children->next->next->node); if (!aggr->group_by) { @@ -400,9 +400,10 @@ vec_t * siridb_aggregate_list(cleri_children_t * children, char * err_msg) next->next->next != NULL) { /* result is always positive, checked earlier */ - aggr->group_by = children->node->children->node-> + aggr->group_by = CLERI_NODE_DATA( + children->node->children->node-> children->next->next->node->children-> - node->result; + node); if (!aggr->group_by) { diff --git a/src/siri/db/listener.c b/src/siri/db/listener.c index 2835b052..9f300fbe 100644 --- a/src/siri/db/listener.c +++ b/src/siri/db/listener.c @@ -870,7 +870,7 @@ static void enter_limit_expr(uv_async_t * handle) siridb_query_t * query = handle->data; siridb_t * siridb = query->client->siridb; query_list_t * qlist = (query_list_t *) query->data; - int64_t limit = query->nodes->node->children->next->node->result; + int64_t limit = CLERI_NODE_DATA(query->nodes->node->children->next->node); if (limit <= 0 || limit > siridb->list_limit) { @@ -1589,7 +1589,8 @@ static void exit_after_expr(uv_async_t * handle) { siridb_query_t * query = handle->data; ((query_select_t *) query->data)->start_ts = - (uint64_t *) &query->nodes->node->children->next->node->result; + (uint64_t *) CLERI_NODE_DATA_ADDR( + query->nodes->node->children->next->node); SIRIPARSER_NEXT_NODE } @@ -1657,7 +1658,8 @@ static void exit_before_expr(uv_async_t * handle) siridb_query_t * query = handle->data; ((query_select_t *) query->data)->end_ts = - (uint64_t *) &query->nodes->node->children->next->node->result; + (uint64_t *) CLERI_NODE_DATA_ADDR( + query->nodes->node->children->next->node); SIRIPARSER_NEXT_NODE } @@ -1667,11 +1669,11 @@ static void exit_between_expr(uv_async_t * handle) siridb_query_t * query = handle->data; query_select_t * q_select = query->data; - q_select->start_ts = (uint64_t *) - &query->nodes->node->children->next->node->result; + q_select->start_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( + query->nodes->node->children->next->node); - q_select->end_ts = (uint64_t *) - &query->nodes->node->children->next->next->next->node->result; + q_select->end_ts = (uint64_t *) CLERI_NODE_DATA_ADDR( + query->nodes->node->children->next->next->next->node); if (*q_select->start_ts > *q_select->end_ts) { @@ -1708,12 +1710,14 @@ static void exit_calc_stmt(uv_async_t * handle) if (!query->factor) { - qp_add_int64(query->packer, calc_node->result); + qp_add_int64(query->packer, CLERI_NODE_DATA(calc_node)); } else { double factor = (double) query->factor; - qp_add_int64(query->packer, (int64_t) (calc_node->result * factor)); + qp_add_int64( + query->packer, + (int64_t) ((CLERI_NODE_DATA(calc_node) * factor))); } SIRIPARSER_ASYNC_NEXT_NODE diff --git a/src/siri/db/query.c b/src/siri/db/query.c index 49d53357..779b20fd 100644 --- a/src/siri/db/query.c +++ b/src/siri/db/query.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -722,13 +723,13 @@ static int QUERY_walk(cleri_node_t * node, siridb_walker_t * walker) buffer[EXPR_MAX_SIZE - size] = 0; /* evaluate the expression */ - if ((rc = expr_parse(&node->result, buffer))) + if ((rc = expr_parse(CLERI_NODE_DATA_ADDR(node), buffer))) { return rc; } /* check if timestamp is valid */ - if (!siridb_int64_valid_ts(walker->siridb->time, node->result)) + if (!siridb_int64_valid_ts(walker->siridb->time, CLERI_NODE_DATA(node))) { return EXPR_TIME_OUT_OF_RANGE; } @@ -750,7 +751,7 @@ static int QUERY_walk(cleri_node_t * node, siridb_walker_t * walker) buffer[EXPR_MAX_SIZE - size] = 0; /* evaluate the expression */ - if ((rc = expr_parse(&node->result, buffer))) + if ((rc = expr_parse(CLERI_NODE_DATA_ADDR(node), buffer))) { return rc; } @@ -1004,7 +1005,7 @@ static int QUERY_rebuild( buf + max_size - *size, *size, "%" PRId64 " ", - node->result); + CLERI_NODE_DATA(node)); if (n >= (ssize_t) *size) { return QUERY_TOO_LONG; diff --git a/src/siri/net/stream.c b/src/siri/net/stream.c index cbcf1e80..f5d5a5c8 100644 --- a/src/siri/net/stream.c +++ b/src/siri/net/stream.c @@ -246,6 +246,7 @@ void sirinet__stream_free(uv_stream_t * uvclient) { case STREAM_PIPE_CLIENT: case STREAM_TCP_CLIENT: /* listens to client connections */ + log_debug("client connection lost"); if (client->origin != NULL) { siridb_user_t * user = client->origin;